<?php
/**
 * @copyright     Copyright 2013, Flash CMM
 * @link          http://flashcmm.com
 * @package       Cake.View.Layouts
 * @since         CakePHP(tm) v 0.10.0.1076
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */

$cakeDescription = __d('cake_dev', 'Flash CMM');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<?php echo $this->Html->charset(); ?>
		<title>
			<?php echo $cakeDescription ?>:
			<?php echo $title_for_layout; ?>
		</title>
		<?php
			echo $this->Html->meta('icon');
			
			echo $this->fetch('meta');

			echo $this->Html->css('libs/bootstrap.min');
			
			echo $this->Html->css('libs/animate.min');
			echo $this->Html->css('libs/bootstrap-glyphicons');
			echo $this->Html->css('core');

			echo $this->fetch('css');
			
			echo $this->fetch('script');
		?>
	</head>

	<body >
		
		<?php echo $this->element('menu/barra_menu'); ?>

		<div id="content" class="container">
			<?php echo $this->Session->flash(); ?>
			<div class="row">


				<div class="col-lg-3 menu-principal">
					
					<?php
					$cmm = $this->Community->getInfos($cmm_url);

					if($cmm['Community']['photo'] == ''){
					echo '<li class="list-group-item"><a href="/!'.$cmm['Community']['url'].'"><img src="/img/photo.jpg" /></a></li>';
	  					
	  				 }  else{ 
					//<img src='/img/communities/<?php echo $cmm['Community']['photo'] ' class="img-cmm"/>
					echo '<li class="list-group-item box-img-cmm"><a href="/!'.$cmm['Community']['url'].'"><img src="/img/communities/'.$cmm['Community']['photo'].'" class="img-cmm"/></a></li>';
						
	  				 } ?>

					

					<ul class="list-group">
					<?php 
					//Info da comunidade
						
					//ocultar o botao participar se o usuario ja participa
						if (($this->Community->userPart($this->User->id(),$cmm['Community']['id'])) == 'n') {
							echo '<li class="list-group-item"><a href="/communities/join/'.$cmm['Community']['id'].'" class="btn btn-success">Participar</a></li>';  
						}
						if (($this->Community->userPart($this->User->id(),$cmm['Community']['id'])) == 'p') {
							echo '<li class="list-group-item">Participação Pendente</li>';  
						}
						if (($this->Community->userPart($this->User->id(),$cmm['Community']['id'])) == 'b') {
							echo '<li class="list-group-item">Participação Banida</li>';   
						}
						?>
					  <li class="list-group-item"><?php echo $cmm['Community']['name']; ?></li>
					  <?php echo '<li class="list-group-item"><a href="/!'.$cmm['Community']['url'].'/members/" >'.$this->Community->countMembers($cmm['Community']['id']).' membros</a></li>';?>
					   <?php 
					  //mostrar botao configurações se o usuario é membro e moderador
					  if ($this->Community->userPartModerador($this->User->id(),$cmm['Community']['id'])) {
					  echo '<li class="list-group-item"><a href="#box-modal" data-cmm='.$cmm['Community']['id'].' data-toggle="modal" class="conf-cmm">Configurações</a></li>';
					  
					  }?>
					  <?php 
						//mostrar botao deixar comunidade se o usuario é membro
					if ($this->Community->userPart($this->User->id(),$cmm['Community']['id'])) {
					  echo '<li class="list-group-item"><a href="/communities/leave/'.$cmm['Community']['id'].'">Deixar comunidade</a></li>';
					} ?>
					</ul>
					<div class=" list-box-cmm">
						
					</div>
				</div>


					<div class="col-lg-9 list-feed ">					
						<?php echo $this->fetch('content'); ?>
					</div>
				</div>
			</div><!-- #header .container -->
		</div>
		<footer class="container " id="rodape">
			<ul class="nav nav-pills">
				<li><a href="#">Sobre</a></li>		
				<li><a href="#">Criar Comunidade	</a></li>	
				<li><a href="#">Privacidade	</a></li>	
				<li><a href="#">Termos	</a></li>	
				<li><a href="#">Ajuda</a></li>	
				<li><a href="#">Feedback</a></li>	
			</ul>
			<span>Flash CMM © 2013 · Brasil</span>
		</footer><!-- #footer .container -->
		
		<?php	
			echo $this->Html->script('libs/jquery');
			echo $this->Html->script('libs/bootstrap.min');
			echo $this->Html->script('ckeditor/ckeditor.js');
    		echo $this->Html->script('ckfinder/ckfinder.js');
			echo $this->Html->script('app'); ?>

				
	</body>

</html>